package school30.ui;
import javax.microedition.lcdui.Graphics;

/**
 * Applications' shape painting gateway
 * @author side.spb
 */
public class Painter {
        private Graphics gr;
        /**
         * Stroke style - solid
         */
        public static final int SOLID = Graphics.SOLID;
        /**
         * Stroke style - dotted
         */
        public static final int DOTTED = Graphics.DOTTED;
        /**
         * 
         */
        public static final int BASELINE = Graphics.BASELINE;
        /**
         *
         */
        public static final int TOP = Graphics.TOP;
        /**
         *
         */
        public static final int BOTTOM = Graphics.BOTTOM;
        /**
         *
         */
        public static final int LEFT = Graphics.LEFT;
        /**
         *
         */
        public static final int RIGHT = Graphics.RIGHT;
        /**
         *
         */
        public static final int HCENTER = Graphics.HCENTER;
        /**
         *
         */
        public static final int VCENTER = Graphics.VCENTER;

        /**
         * Default constructor, generally called by OS, is supplied with a graphics object it operates.
         * @param g -Graphics pointed to main OS Image (usually), Painter tracks whether app can use it
         */
        public Painter(Graphics g) {
            gr = g;
        }


        /**
         * Allows to draw OUTLINE rectangles.
         * @param x - left border, x
         * @param y - top border, y
         * @param w - width
         * @param h - height
         */
        public void drawRectangle(int x, int y, int w, int h) {
            if (true)
              gr.drawRect(x, y, w, h);
        }

        /**
         * Allows to draw FILLED rectangles
         * @param x - left border, x
         * @param y - top border, y
         * @param w - width
         * @param h - height
         */
        public void fillRectangle(int x, int y, int w, int h) {
            if (true)
              gr.fillRect(x, y, w, h);
        }


        /**
         * Set current drawing color, R, G, B (0-255)
         * @param r - red (0-255)
         * @param g - green (0-255)
         * @param b - blue (0-255)
         */
        public void setColor(int r, int g, int b) {
            if (true)
              gr.setColor(r, g, b);
        }

        /**
         * Set current drawing color, single integer
         * @param color - drawing color
         */
        public void setColor(int color) {
            if (true)
              gr.setColor(color);
        }

        /**
         * Set stroke style for drawing lines
         * @param style - constant for drawing stroke style, either "SOLID" or "DOTTED".
         */
        public void setStroke(int style) {
            if (true)
              gr.setStrokeStyle(style);
        }



        /**
         *
         * @param x the x coordinate of the upper-left corner of the arc to be drawnx
         * @param y the y coordinate of the upper-left corner of the arc to be drawn
         * @param h the height of the arc to be drawn
         * @param w the width of the arc to be drawn
         * @param startAngle the beginning angle
         * @param relativeAngle the angular extent of the arc (relative to startAngle)
         */
        public void drawArc(int x,int y, int h, int w, int startAngle, int relativeAngle) {
            if (true)
                gr.drawArc(x,y,w,h,startAngle,relativeAngle);
        }



}